`ifndef {{NAME}}_ENV__SV
`define {{NAME}}_ENV__SV

`include "{{name}}_if.sv"
`include "{{name}}_transaction.sv"
`include "{{name}}_sequencer.sv"
`include "{{name}}_driver.sv"
`include "{{name}}_monitor.sv"
`include "{{name}}_agent.sv"
`include "{{name}}_model.sv"
`include "{{name}}_scoreboard.sv"

class {{name}}_env extends uvm_env;

    {{name}}_agent i_agt;
    {{name}}_agent o_agt;
    {{name}}_model mdl;
    {{name}}_scoreboard scb;

    uvm_tlm_analysis_fifo #({{name}}_transaction) agt_mdl_fifo;
    uvm_tlm_analysis_fifo #({{name}}_transaction) agt_scb_fifo;
    uvm_tlm_analysis_fifo #({{name}}_transaction) mdl_scb_fifo;

    function new(string name = "{{name}}_env", uvm_component parent);
        super.new(name, parent);
    endfunction //new()
    
    extern virtual function void build_phase(uvm_phase phase);
    extern virtual function void connect_phase(uvm_phase phase);

    `uvm_component_utils({{name}}_env);
endclass //{{name}}_env extends uvm_env

function void {{name}}_env::connect_phase(uvm_phase phase);
    super.connect_phase(phase);
    i_agt.ap.connect(agt_mdl_fifo.analysis_export);
    mdl.port.connect(agt_mdl_fifo.blocking_get_export);
    mdl.ap.connect(mdl_scb_fifo.analysis_export);
    scb.exp_port.connect(mdl_scb_fifo.blocking_get_export);
    o_agt.ap.connect(agt_scb_fifo.analysis_export);
    scb.act_port.connect(agt_scb_fifo.blocking_get_export); 
endfunction

function void {{name}}_env::build_phase(uvm_phase phase);
    super.build_phase(phase);
    i_agt = {{name}}_agent::type_id::create("i_agt", this);
    o_agt = {{name}}_agent::type_id::create("o_agt", this);
    i_agt.is_active = UVM_ACTIVE;
    o_agt.is_active = UVM_PASSIVE;
    mdl = {{name}}_model::type_id::create("mdl", this);
    scb = {{name}}_scoreboard::type_id::create("scb", this);
    agt_mdl_fifo = new("agt_mdl_fifo", this);
    agt_scb_fifo = new("agt_scb_fifo", this);
    mdl_scb_fifo = new("mdl_scb_fifo", this);
endfunction

`endif